﻿using BigEgg.Framework.Foundation;
using BigEgg.Framework.UnitTesting;
using FMStudio.Domain.Properties;
using FMStudio.Domain.Test.MockClasses;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Globalization;

namespace FMStudio.Domain.Test
{
    [TestClass]
    public class PayTypeCategoryTest
    {
        [TestMethod]
        public void PayTypeCategoryNameValidationTest()
        {
            MockPayTypeCategory payTypeCategory = new MockPayTypeCategory();

            Assert.IsNull(payTypeCategory.Name);
            Assert.AreEqual(Resources.PayTypeCategoryNameMandatory, payTypeCategory.Validate("Name"));

            payTypeCategory.Name = TestHelper.CreateString('A', 99);
            Assert.AreEqual("", payTypeCategory.Validate("Name"));
            payTypeCategory.Name = TestHelper.CreateString('A', 100);
            Assert.AreEqual("", payTypeCategory.Validate("Name"));
            payTypeCategory.Name = TestHelper.CreateString('A', 101);
            Assert.AreEqual(
                string.Format(CultureInfo.CurrentCulture, Resources.PayTypeCategoryNameMaxLength, "Name", 100)
                , payTypeCategory.Validate("Name"));
        }

        [TestMethod]
        public void PayTypeCategoryCurrencyValidationTest()
        {
            MockPayTypeCategory payTypeCategory = new MockPayTypeCategory();

            Assert.IsNull(payTypeCategory.Currency);
            Assert.AreEqual(Resources.CurrencyMandatory, payTypeCategory.Validate("Currency"));

            MockCurrency currency = new MockCurrency();
            payTypeCategory.Currency = currency;
            Assert.AreEqual("", payTypeCategory.Validate("Currency"));
        }
    }}
